<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  props: {
    total: {
      type: Number,
      default: 0,
    },
    size: {
      type: Number,
      default: 10,
    },
  },
  emits: ["handleChangePage"],
  setup(props, context) {
    const nextClick = (page: string) => {
      context.emit("handleChangePage", page);
      document.body.scrollTop = document.documentElement.scrollTop =  0
    };
    return {
      nextClick,
    };
  },
});
</script>

<template>
  <div class="page">
    <el-pagination
      layout="total, prev, pager, next, jumper"
      :page-size="size"
      :total="total"
      @current-change="nextClick"
    />
  </div>
</template>

<style lang="scss" scoped>
.page {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 30px 0;
}
</style>